home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / exampleCode / opengl / GLUT / progs / fortran / fbitfont.f < prev    next >
Encoding:
Text File  |  1996-11-11  |  1.8 KB  |  70 lines

  1.  
  2. C  Copyright (c) Mark J. Kilgard, 1994.
  3.  
  4. C  This program is freely distributable without licensing fees
  5. C  and is provided without guarantee or warrantee expressed or
  6. C  implied.  This program is -not- in the public domain.
  7.  
  8. C  GLUT Fortran example demonstrating use of bitmap fonts.
  9.  
  10.     subroutine output(x,y,s)
  11.     real x,y
  12.     character s*(*)
  13.     character c
  14. #include "GL/fgl.h"
  15. #include "GL/fglut.h"
  16.  
  17. C  XXX Stroke and font names must be explicitly declared as
  18. C  external instead of relying on "GL/fglut.h" because
  19. C  the IRIX Fortran compiler does not know to only
  20. C  link in used external data symbols.
  21.     external GLUT_BITMAP_TIMES_ROMAN_24
  22.  
  23.     call fglrasterpos2f(x,y)
  24.     lenc = len(s)
  25.     do 10, i=1,lenc
  26.       c = s(i:i)
  27.       call glutbitmapcharacter(GLUT_BITMAP_TIMES_ROMAN_24,
  28.      2      ichar(c))
  29. 10    continue
  30.     end
  31.  
  32.     subroutine display
  33. #include "GL/fgl.h"
  34. #include "GL/fglut.h"
  35.     call fglclear(GL_COLOR_BUFFER_BIT)
  36.     call output(0.0,24.0,
  37.      2    'This is written in a GLUT bitmap font.')
  38.     call output(100.0,100.0,'ABCDEFGabcdefg')
  39.     call output(50.0,145.0,
  40.      2    '(positioned in pixels with upper-left origin)')
  41.     end
  42.  
  43.     subroutine reshape(w,h)
  44.     integer w, h
  45. #include "GL/fgl.h"
  46. #include "GL/fglu.h"
  47.     call fglviewport(0, 0, w, h)
  48.     call fglmatrixmode(GL_PROJECTION)
  49.     call fglloadidentity
  50.     call fgluortho2d(dble(0.0), dble(w), dble(0.0), dble(h))
  51.     call fglscalef(1.0, -1.0, 1.0)
  52.     call fgltranslatef(real(0.0), real(-h), real(0.0))
  53.     call fglmatrixmode(GL_MODELVIEW)
  54.     end
  55.  
  56.     program main
  57. #include "GL/fglut.h"
  58.     external display
  59.     external reshape
  60.     call glutinitdisplaymode(GLUT_RGB + GLUT_SINGLE)
  61.     call glutinitwindowsize(500, 150)
  62.     call glutinit
  63.     call glutcreatewindow('Fortran GLUT bitmap A')
  64.     call fglclearcolor(0.0, 0.0, 0.0, 1.0)
  65.     call glutdisplayfunc(display)
  66.     call glutreshapefunc(reshape)
  67.     call glutmainloop
  68.     end
  69.  
  70.